package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.UserMessage;
import cn.wolfcode.trip.base.mapper.UserMessageMapper;
import cn.wolfcode.trip.base.service.ILetterService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class LetterServiceImpl implements ILetterService {
    @Autowired
    private UserMessageMapper messageMapper;
    @Override
    public void save(UserMessage message) {
        messageMapper.insert(message);
    }

    @Override
    public List<UserMessage> selectOldMessage(String user1Id, String user2Id) {
        List<UserMessage> list = messageMapper.selectForUserId(user1Id, user2Id);
        return list;
    }

    @Override
    public void clean(String user1Id, String user2Id) {
        messageMapper.updateState(user1Id,user2Id);
    }
}
